#include <cstdio>
#include <cstdlib>
#include "string.h"

#include "automate.H"


int main()
{
    automate Auto;
    int * etat_final;
    const char * mot;
    mot = "abbba";
    etat_final = (int *) malloc(sizeof(int));
    etat_final[0] = 0;
    initialise_automate(Auto, 0, etat_final,mot,1);
    unsigned int i;
    for (i=0; i < strlen(Auto.mot);i++)
    {
        if (Auto.mot[i] == 'a')
        {
            fonction_transition_fini_par_a(Auto, 0);
        }
        else
        {
            fonction_transition_fini_par_a(Auto, 1);
        }
    }
   for (i=0; i<1; i++)
   {
       if (Auto.etat_courant == Auto.etat_final[i])
       {
           printf("le mot est accepte\n");
           return 0;
       }
   }
   printf("le mot est refuse\n");
   return 0;
}
